#include "OcrToTxt.hpp"
#include <QTextStream>
#include "OcroIze.hpp"

float OcrToTxt::doAction(const QFileInfo &f)
{
    OcroIze o;
    std::string txt = o.run(f.absoluteFilePath().toStdString());


    QString ocrFilePath = f.absoluteDir().absolutePath().append("/") ;
    ocrFilePath.append(f.baseName().replace("image","ocrOpus").append(".txt"));

    QFile outFile(ocrFilePath);
    outFile.open(QIODevice::WriteOnly | QIODevice::Text);
    QTextStream outStream(&outFile);
    outStream << QString::fromStdString(txt);
    return 0.0;

}
